<template>
  <div class="title">我的页面123</div>
  <div class="box"></div>
  <div v-for="item in comlist" :key="item.id">{{ item.company }}</div>

  <div @click="jump">跳转1</div>
  <div @click="jumps">跳转2</div>
</template>

<script setup lang="ts">
import { ref, onMounted } from "vue";
import { getcustomerApi } from "../../http/index";
import { onHide, onShow } from "@dcloudio/uni-app";
// import { useRouter } from "../../utils/utils";
// import { showToast } from "vant";
const comlist = ref<any>([]);
const pageable = ref({
  //分页数据
  pageindex: 1, //当前页数
  pagesize: 20, //每页显示条数
  total: 0, //总条数
  keyword: "",
});

const useRouter = (url, params = {}, type = "navigateTo") => {
  try {
    if (Object.keys(params).length)
      url = `${url}?data=${encodeURIComponent(JSON.stringify(params))}`;
    if (type == "navigateBack") {
      uni[type]({ delta: url });
    } else {
      uni[type]({ url });
    }
  } catch (error) {
    console.error(error);
  }
};
const jump = () => {
  uni.navigateTo({
    url: "/pages/mysub/question/index",
  });
};

const jumps = () => {
  uni.navigateTo({
    url: "/pages/mysub/issue/index",
  });
};
const getcustomer = async () => {
  try {
    const res = await getcustomerApi(pageable.value);
    if (res.code == 200) {
      comlist.value = res.data;
    }
  } catch (error) {}
};
onMounted(() => {});

onShow(() => {
  console.log("show");
  getcustomer();
});
onHide(() => {
  console.log("hide");
});
</script>

<style>
@import url("./index.less");
</style>
